dojo.provide("dojoc.form.TimeSpinner");

dojo.require("dijit._Widget");
dojo.require("dijit._Templated");
dojo.require("dijit.form.NumberSpinner");
dojo.require("dijit.form.FilteringSelect");

dojo.declare("dojoc.form.TimeSpinner",
	[dijit._Widget, dijit._Templated],
{
	templatePath: dojo.moduleUrl("dojoc.form", "templates/TimeSpinner.html"),
	widgetsInTemplate: true,

	value: new Date(),

	
	setValue: function(/*Date*/ value){
		// summary:
		//      Deprecated.   Used attr('value', ...) instead.
		// tags:
		//      deprecated
		dojo.deprecated("dijit.Calendar:setValue() is deprecated.  Use attr('value', ...) instead.", "", "2.0");
		this.attr('value', value);
	},
	
	_setValueAttr: function(/*Date*/ value){
		if (!this.value || dojo.date.compare(value, this.value)){
			this.value = new Date(value);
			this.hours.attr('value',this.value.getHours());
			this.minutes.attr('value',this.value.getMinutes());
			this.seconds.attr('value',this.value.getSeconds());
		}
	},
	
	getValue: function(/*Date*/ value){
		dojo.deprecated("dojoc.form.Timestamp:getValue() is deprecated.  Use attr('value', ...) instead.", "", "2.0");
		this.attr(value);
	},

	_getValueAttr: function() {
		var date = new Date();
		date.setHours(this.hours.attr('value'));
		date.setMinutes(this.minutes.attr('value'));
		date.setSeconds(this.seconds.attr('value'));
		return date;
	},

});
	
